package net.wwang.blog.dao;

import net.wwang.blog.pojo.Category;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;


public interface CategoryDao extends JpaRepository<Category,String>, JpaSpecificationExecutor<Category> {
    Category findCategoryById(String categoryId);

    int deleteAllById(String categoryId);

    @Modifying
    @Query(nativeQuery=true,value="update `category` set `state`= '0' where `id` = ?1")
    int updateState(String categoryId);
}
